package cn.john.basic.util;

import lombok.Data;

@Data
public class AjaxResult {
    private Boolean success = true;
    private String message = "操作成功！";

    // 返回一些扩展信息
    private Object resultObj;

    public static AjaxResult me() {
        return new AjaxResult();
    }

    public static AjaxResult setMessage(){
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.success = false;
        ajaxResult.message = "操作失败！";
        return ajaxResult;
    }

    public AjaxResult setSuccess(boolean success) {
        this.success = success;
        return this;
    }

    public AjaxResult setMessage(String message){
        this.success = false;
        this.message = message;
        return this;
    }

    public AjaxResult setResultObj(Object resultObj) {
        this.resultObj = resultObj;
        return this;
    }
}
